Skip to content

feat(cloudflare): Set server name and runtime version from the wrangler config - #26427

Merged
JPeer264 merged 1 commit into
developfrom
jp/cloudflare-runtime-version-server-name
Nov 17, 2026
Merged

JPeer264 merged 1 commit into
developfrom
jp/cloudflare-runtime-version-server-name

Conversation

@JPeer264

Copy link
Copy Markdown
Member

closes #24040
closes JS-3575

Description

This sets server_name and the runtime version on Cloudflare events. server_name comes from the SENTRY_NAME variable of env, else from the name of the wrangler config. The runtime version is the compatibility_date of the wrangler config. sentryCloudflareVitePlugin writes both wrangler values into the Worker entry at build time, also when you wrap the handler yourself. Logs and metrics get server.address from the same server name.

Version decisions

workerd exposes no version at runtime, so the version is the compatibility date, which selects the workerd behavior of the Worker. The alternative is to leave the version empty.

Known issues

  • Without sentryCloudflareVitePlugin, only SENTRY_NAME or the serverName option sets server_name, and events have no runtime version.

Sentry events

Without the plugin values (same as develop): https://sentry-sdks.sentry.io/issues/7850779574/events/cd8261c3c7d84022b2f4baeeafa18bf8/
With the plugin values: https://sentry-sdks.sentry.io/issues/7850779574/events/3375bc8be6ba47f2aa8ba95cefe0e064/

@linear-code

linear-code Bot commented Nov 16, 2026

Copy link
Copy Markdown

JS-3575

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: ea280e8 (PR test merge using develop at 1d3a542)

Against: 1d3a542 (develop) · base run #66400

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.1 kB - -
@sentry/browser - with treeshaking flags 28.3 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.2 kB - -
@sentry/browser (incl. Tracing) 52.28 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.29 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.25 kB - -
@sentry/browser (incl. Tracing, Replay) 92.82 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.6 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.21 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.6 kB - -
@sentry/browser (incl. Feedback) 47.73 kB - -
@sentry/browser (incl. sendFeedback) 30.69 kB - -
@sentry/browser (incl. FeedbackAsync) 35.69 kB - -
@sentry/browser (incl. Metrics) 31.43 kB - -
@sentry/browser (incl. Logs) 31.71 kB - -
@sentry/browser (incl. Metrics & Logs) 32.37 kB - -
@sentry/react 32.11 kB - -
@sentry/react (incl. Tracing) 54.95 kB - -
@sentry/vue 38.29 kB - -
@sentry/vue (incl. Tracing) 55.24 kB - -
@sentry/svelte 30.12 kB - -
@sentry/remix (Remix 3 client bundle) 58.06 kB - -
CDN Bundle 31.87 kB - -
CDN Bundle (incl. Tracing) 52.7 kB - -
CDN Bundle (incl. Logs, Metrics) 34.67 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.26 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.7 kB - -
CDN Bundle (incl. Tracing, Replay) 90.72 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.09 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.69 kB - -
CDN Bundle - uncompressed 92.98 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.45 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.33 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.08 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 231.44 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.61 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 283.24 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.4 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.02 kB - -
@sentry/nextjs (client) 58.57 kB - -
@sentry/sveltekit (client) 53.57 kB - -
@sentry/core/server 44.8 kB - -
@sentry/core/browser 14.4 kB - -
@sentry/node 151.36 kB -0.01% -6 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.3 kB - -
@sentry/node - without tracing 88.56 kB -0.01% -6 B 🔽
@sentry/node - without channel injection 140.3 kB -0.01% -5 B 🔽
@sentry/aws-serverless 98.93 kB -0.01% -6 B 🔽
@sentry/cloudflare (withSentry) - minified 206.61 kB +0.07% +140 B 🔺
@sentry/cloudflare (withSentry) 479.48 kB +0.06% +263 B 🔺
@sentry/nextjs/cloudflare (withSentry) - minified 231.97 kB +0.07% +140 B 🔺

View base workflow run

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 2 not successful, 35 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Failing after 3m Details
❌ CI: Optional E2E Tests / E2E nextjs-16-cacheComponents (cloudflare) Test (optional) Failing after 10m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 43s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 53s Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) Successful in 51s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (cloudflare) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 51s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 45s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (latest) Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 49s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 43s Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 28s Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (bun) Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (deno) Test (optional) Successful in 51s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 37s Details

@JPeer264
JPeer264 force-pushed the jp/cloudflare-runtime-version-server-name branch 2 times, most recently from dc40219 to 97acff2 Compare November 17, 2026 10:31
…er config

Cloudflare events had no `server_name` and no runtime version, so events
could not be grouped or filtered by Worker.

`getFinalOptions` now reads `serverName` from the `SENTRY_NAME` variable of
`env`. The Vite plugin also stores the `name` and `compatibility_date` of
the wrangler config in the Worker entry, also for handlers that are
wrapped by hand. `CloudflareClient` uses the name as the default
`serverName` and the compatibility date as `runtime.version`, because
workerd exposes no version at runtime. The plugin uses a global value and
not a Vite `define`, because Vite does not apply `define` to pre-bundled
dependencies in dev.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264
JPeer264 force-pushed the jp/cloudflare-runtime-version-server-name branch from 97acff2 to a080043 Compare November 17, 2026 10:41
@JPeer264
JPeer264 marked this pull request as ready for review November 17, 2026 10:45
@JPeer264 JPeer264 self-assigned this Nov 17, 2026
@JPeer264
JPeer264 merged commit 09a1d4f into develop Nov 17, 2026
261 of 263 checks passed
@JPeer264
JPeer264 deleted the jp/cloudflare-runtime-version-server-name branch November 17, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cloudflare events have no runtime version and no server name

2 participants